import React, { useEffect ,useState} from 'react';
import { useNavigate } from 'react-router-dom'
import { useSelector } from 'react-redux';
const Index = () => {
    const [nowCity,setNowCity]=useState('')
    const Navigate = useNavigate()
    const city = useSelector(state => state.cityer.city)
    const handleCity = () => {
        Navigate('/about')
    }
    // 
    useEffect(() => {
        
        var City = localStorage.getItem('nowCity')
        if(City){
            setNowCity(City)
        }
        else{
            setNowCity(city)
        }
    },[]);
    return (
        <div>
            <button onClick={() => { handleCity() }}>{nowCity}</button>
        </div>
    );
}

export default Index;
